/**
* Oxide
*
* Copyright (c) 2011 Dinosaur Kick Pty Ltd, All rights reserved.
*
* This source code is made available under the "Modified BSD" licensing arrangement.
* See license.txt for details.
*/
// ----------------------------------------------------------------------------

bool lex_identifier(void)
{
	assert(is_identifier_char(*m_cursor, true));
	setup_token(TOK_IDENTIFIER);

	do
	{
		m_token.content += m_cursor.get();
	} while (m_cursor && is_identifier_char(*m_cursor));

	m_token.identity = m_keyword_map[m_token.content];
	return true;
}

// ----------------------------------------------------------------------------

bool is_identifier_char(char_type ch, bool initial_only = false) const
{
	return ch == '_'
		|| std::isalpha(ch)
		|| (!initial_only && std::isdigit(ch));
}

// ----------------------------------------------------------------------------
